package com.huawei.gamebox.plugin.gameservice.service;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import com.huawei.appgallery.assistantdock.base.service.base.dispatch.GameServiceMethod;
import com.huawei.gamebox.plugin.gameservice.bean.GameInfo;
import o.Logger;
import o.erz;
import o.eyz;
import o.ezp;
import o.ezt;
import o.ezu;
import o.ezv;
import o.ezw;
import o.fab;
import o.fac;
import o.fad;
import o.fag.b;
import o.fah;

public class GameServiceApi extends Service {
    private d ˏ = new d();

    class d extends b {
        final /* synthetic */ GameServiceApi ˏ;

        private d(GameServiceApi gameServiceApi) {
            this.ˏ = gameServiceApi;
        }

        public void ˏ(RequestInfo requestInfo, fad o_fad) throws RemoteException {
            if (requestInfo == null || o_fad == null) {
                Logger.e("GameServiceApi", "the param is null when call init");
                return;
            }
            GameInfo gameInfo = new GameInfo();
            gameInfo.setSdkVersionCode(requestInfo.ˋ());
            gameInfo.setSdkVersionName(requestInfo.ˏ());
            gameInfo.setCpId(requestInfo.ˊ());
            gameInfo.setPackageName(requestInfo.ॱॱ());
            gameInfo.setAppId(requestInfo.ˎ());
            ezv.ॱ().ˎ(this.ˏ, gameInfo, "switchGameSubAcct", o_fad);
            fab.ˎ().ˊ(gameInfo, o_fad);
            ezw.ॱ().ˎ(o_fad);
            ezt.ˏ().ˋ(gameInfo, requestInfo.ʽ(), erz.ˋ(this.ˏ, gameInfo.getPackageName()), requestInfo.ʼ(), o_fad);
            ezt.ˏ().ॱ();
        }

        public void ˊ(RequestInfo requestInfo, fad o_fad) throws RemoteException {
            if (requestInfo == null || o_fad == null) {
                Logger.e("GameServiceApi", "the param is null when call request");
            } else if (ezw.ॱ().ˊ()) {
                GameInfo gameInfo = new GameInfo();
                gameInfo.setSdkVersionCode(requestInfo.ˋ());
                gameInfo.setSdkVersionName(requestInfo.ˏ());
                gameInfo.setCpId(requestInfo.ˊ());
                gameInfo.setPackageName(requestInfo.ॱॱ());
                gameInfo.setAppId(requestInfo.ˎ());
                ezv.ॱ().ˎ(this.ˏ, gameInfo, "switchGameSubAcct", o_fad);
                fab.ˎ().ˊ(gameInfo, o_fad);
                this.ˏ.ˏ(requestInfo, gameInfo, o_fad);
            } else {
                Logger.e("GameServiceApi", "protocol not checked, the request not run");
            }
        }
    }

    public IBinder onBind(Intent intent) {
        if (Logger.ˎ()) {
            Logger.ˏ("GameServiceApi", "the AIDL service for GameServiceSDK onBind");
        }
        ezw.ॱ().ˏ();
        return this.ˏ;
    }

    public boolean onUnbind(Intent intent) {
        if (Logger.ˎ()) {
            Logger.ˏ("GameServiceApi", "the AIDL service for GameServiceSDK onUnbind");
        }
        ezw.ॱ().ˏ();
        return super.onUnbind(intent);
    }

    public void onRebind(Intent intent) {
        if (Logger.ˎ()) {
            Logger.ˏ("GameServiceApi", "the AIDL service for GameServiceSDK onRebind");
        }
        super.onRebind(intent);
    }

    public void onStart(Intent intent, int i) {
        if (Logger.ˎ()) {
            Logger.ˏ("GameServiceApi", "the AIDL service for GameServiceSDK onStart:" + i);
        }
        super.onStart(intent, i);
    }

    public void onCreate() {
        if (Logger.ˎ()) {
            Logger.ˏ("GameServiceApi", "the AIDL service for GameServiceSDK onCreate");
        }
        super.onCreate();
    }

    public void onDestroy() {
        if (Logger.ˎ()) {
            Logger.ˏ("GameServiceApi", "the AIDL service for GameServiceSDK onDestroy");
        }
        super.onDestroy();
        ezw.ॱ().ˎ();
    }

    private void ˏ(RequestInfo requestInfo, GameInfo gameInfo, fad o_fad) {
        String ॱ = requestInfo.ॱ();
        if (Logger.ˎ()) {
            Logger.ˏ("GameServiceApi", "request method:" + ॱ);
        }
        Object obj = -1;
        switch (ॱ.hashCode()) {
            case -1736395873:
                if (ॱ.equals("getGameUpdateInfo")) {
                    obj = null;
                    break;
                }
                break;
            case -504586225:
                if (ॱ.equals("openView")) {
                    obj = 7;
                    break;
                }
                break;
            case 24209339:
                if (ॱ.equals(GameServiceMethod.METHOD_GET_GAME_BUOY_ENTRY_INFO)) {
                    obj = 3;
                    break;
                }
                break;
            case 182274400:
                if (ॱ.equals("getGameNotice")) {
                    obj = 1;
                    break;
                }
                break;
            case 534074451:
                if (ॱ.equals("getGameBuoyInfo")) {
                    obj = 2;
                    break;
                }
                break;
            case 889710464:
                if (ॱ.equals("getUserMsg")) {
                    obj = 4;
                    break;
                }
                break;
            case 1797772069:
                if (ॱ.equals("getPlayerInfo")) {
                    obj = 6;
                    break;
                }
                break;
            case 2115558064:
                if (ॱ.equals("addPlayerInfo")) {
                    obj = 5;
                    break;
                }
                break;
        }
        switch (obj) {
            case null:
                new fac(ॱ, o_fad).ˊ(this, gameInfo, requestInfo.ᐝ());
                return;
            case 1:
                new fac(ॱ, o_fad).ॱ(this, gameInfo);
                return;
            case 2:
                new fac(ॱ, o_fad).ˋ(gameInfo);
                return;
            case 3:
                new fac(ॱ, o_fad).ˎ(gameInfo);
                return;
            case 4:
                new fac(ॱ, o_fad).ˊ(gameInfo, requestInfo.ʻ());
                return;
            case 5:
                new fac(ॱ, o_fad).ˎ(gameInfo, requestInfo.ʻ());
                return;
            case 6:
                ezp.ˊ().ˋ(gameInfo, ॱ, o_fad);
                return;
            case 7:
                fab.ˎ().ˏ(gameInfo, requestInfo.ʻ(), o_fad);
                return;
            default:
                ˎ(requestInfo, gameInfo, o_fad, ॱ);
                return;
        }
    }

    private void ˎ(RequestInfo requestInfo, GameInfo gameInfo, fad o_fad, String str) {
        boolean z = true;
        switch (str.hashCode()) {
            case -1820513715:
                if (str.equals("switchGameSubAcct")) {
                    z = false;
                    break;
                }
                break;
            case -101123091:
                if (str.equals("getPlayerLevel")) {
                    z = true;
                    break;
                }
                break;
            case 103149417:
                if (str.equals("login")) {
                    z = true;
                    break;
                }
                break;
        }
        switch (z) {
            case false:
                ezv.ॱ().ˎ(this, gameInfo, str, o_fad);
                ezv.ॱ().ॱ(false);
                return;
            case true:
                fah.ॱ().ˏ();
                ezu.ˊ().ˎ(this, gameInfo, new eyz(requestInfo.ˊॱ(), requestInfo.ॱˊ(), requestInfo.ॱ(), requestInfo.ʻ()), o_fad);
                ezu.ˊ().ˋ();
                return;
            case true:
                new fac(str, o_fad).ˋ();
                return;
            default:
                return;
        }
    }
}
